package Items;

/**
 * FoodItem: An abstract representation of a food item in the game. FoodItem objects
 * decay and have set lifespans. A FoodItem knows if it can still be consumed.
 * 
 * @author Branon Lyle
 */
public abstract class FoodItem extends Item {
    
    /* days remaining before the FoodItem is inedible */
    private int daysRemaining;
    
    /**
     * FoodItem Constructor
     * @param basePrice base price 
     * @param kleptons  time space value
     * @param description   what i it
     * @param daysRemaining expiration date
     */
    public FoodItem(int basePrice, int kleptons, int quantity, String description, int daysRemaining) {
        super(basePrice, kleptons, quantity, description);
        this.daysRemaining = daysRemaining;
    }
    
    /**
     * dayRemaining Accessor
     * @return int daysRemaining, the days remaining before the FoodItem is inedible
     */
    public int getDaysRemaining() {
        return daysRemaining;
    }
    
    /**
     * String representation of a FoodItem
     * @return name
     */
    public String toString() {
        return "Food Item";
    }
    
    /**
     * The food decays a little. Its daysRemaining is decremented.
     */
    public void decay() {
        daysRemaining--;
    }
    
    /**
     * Determines if the FoodItem can still be consumed
     * @return boolean true if the FoodItem can still be consumed
     */
    public boolean isEdible() {
        return daysRemaining != 0;
    }
}
